<extend name="./Common/View/Public/list.html" />

<block name="page_title">菜单列表</block>
<block name="search">
    <div class="layui-input-inline">
        <select name="app_id" id="app_id" lay-filter="app_id" api="sys/Application/slist/status/1" affect="#pid" empty="应用"></select>
    </div>
    <div class="layui-input-inline">
        <select name="pid" id="pid" lay-filter="pid" tree="sys/Menu/tree" empty="上级菜单"></select>
    </div>
    <div class="layui-input-inline">
        <select name="type" id="type" lay-filter="type" api="sys/Dict/info/code/MENU_TYPE" empty="分类"></select>
    </div>
    <div class="layui-input-inline">
        <select name="status" id="status" lay-filter="status" api="sys/Dict/info/code/STATUS" empty="状态"></select>
    </div>
    <div class="layui-input-inline">
                <input class="layui-input" name="keywords" autocomplete="off" placeholder="名称" />
    </div>
</block>

<block name="toolbar">
    {:W('Todo/UI/toolbar',array('菜单',array('add','delete','enable','disable')))}
</block>

<block name="main">
    <script type="text/javascript">
        var list = {api:"{$Think.const.MODULE_NAME}/{$Think.const.CONTROLLER_NAME}/"};
        list.columns =  [[
            {checkbox: true, fixed: true}
            , {field:'title', minWidth:100, title : '菜单名称'}
            , {field:'url', minWidth:200, title : '操作地址'}
            , {field:'pid', minWidth:100, title : '上级菜单', templet: '#tpl_parent'}
            , {field:'app_id', minWidth:150, title : '所属应用', sort: true, templet: '#tpl_app'}
            , {field: 'status', title: '状态', width: 80, sort: true, templet: '#tpl_status'}
            , {field: 'sort', title: '排序', width: 80, sort: true}
            ,{fixed: 'right', minWidth:100, align:'center', toolbar: '#tpl_bar'}
        ]];
    </script>
    <script type="text/html" id="tpl_bar">
        {{ format_optbar(['edit','delete']) }}
    </script>
    <script type="text/html" id="tpl_app">
        {{ format_data_application(d.app_id) }}
    </script>
    <script type="text/html" id="tpl_parent">
        {{ format_data_menu(d.pid) }}
    </script>
    <script type="text/html" id="tpl_status">
        {{#  if(d.status == '1'){ }}
        启用
        {{#  } else { }}
        禁用
        {{#  } }}
    </script>
</block>
<block name="script">
    <script src="/api/Sys/Application/format"></script>
    <script src="/api/Sys/Menu/format"></script>
</block>